cap cd "/Users/ddgueorg/Dropbox/C-GAP/C-GAP Replication Files/Coding"
cap cd "C:\Users\ejm5\Dropbox\C-GAP\C-GAP Replication Files\Coding"

clear all
set more off 
*****

**Data Composition**
cd "../Data"

use "cgap_5.2.dta"

set more off
drop if provincecode==.
drop if year==.
xtset provincecode year
drop _merge

/* Data Cleaning */
sort province year
order  province year provincecode code cpoptot cpopadulttot cpopcoltot cpopnettot cpopworktot cecongrpnum ceconlabortot cfinexptot clegcongtot clegcaptot cleggovtot oecongdppc pdepletcon~m pdeplabortot pdeppccnum pdeplabora~t pdeplabors~t pdeplaborc~m pdeplaborw~m  tdeplandper pdepenvadpennum pdepenvadrevnum pdepcomadpennum pdepcrimesocnum pdepcrimeobstrnum pnoticomenvnum plabormeetnum plabordraftnum plaborlegservnum pcomgovnum pcomgovnum2 pcomlocallaw pcomprovreg pcomprovdoc pregppreqnum ppubhcongnum ppubhgovnum ppubhenvnum clegcongtot2
replace plabordraftnum = "." if plabordraftnum=="    -" | plabordraftnum=="-"
replace plaborlegservnum = "." if plaborlegservnum=="-"
destring  pdepenvadpennum pdepenvadrevnum pdepcomadpennum pdepcrimesocnum pdepcrimeobstrnum pnoticomenvnum plabormeetnum plabordraftnum plaborlegservnum ppubhenvnum  plaborresolvenum plaborreformnum pdepcomexamnum pdepcomadrevnum pdepcomadlitnum ppubhcomtot ppubhcomnum pdepcrimepubnum pdepcrimepropnum pdepcrimedistnum pdepcrimevionum, replace
replace plabordraftnum=. if plabordraftnum==9999
replace plabormeetnum=. if  plabormeetnum==9999
replace pcsonum=. if pcsonum==0
replace cfinexptot=cfinexptot*10 if year==2002 & provincecode==10
generate internet_penetration= cpopnettot/ cpoptot
generate missuse_expend= (tdepmisnum /cfinexptot)*10000
generate ln_missue=ln(missuse_expend)
generate cases_cap = (tdepmiscournum/ cpopworktot)*1000000

/* Merging in Outside Data */
merge m:m province year using "transparency Addition Sept 2012.dta", update replace force
drop _merge
merge m:m province year using "participation_addition_Nov13.dta", update replace force
replace plabormeetnum = plabormeetnum2 if plabormeetnum==.
drop plabormeetnum2
replace pdeplabortot=pdeplaboracctot if pdeplaboracctot!=.
drop _merge
drop cpopworktot
merge m:m province year using "worker_shares_Nov13.dta", update force
drop _merge
drop if provincecode==.
merge m:m province year using "participation_master_pid.dta", update force
drop _merge
sort province year
replace provincecode=provincecode[_n-1] if province==province[_n-1]
replace provincecode=provincecode[_n+1] if province==province[_n+1]
fillin pid year
drop if provincecode ==.
replace labor=0 if labor==.
replace env=0 if env==.
replace count=0 if count==.
merge m:m province year using "law_types.dta"
drop _merge
drop if provincecode ==.
xtset provincecode year

*Fixing Errors in the master data*
replace pdepenv_xfnum=. if year==2008 & province=="Guangxi"
replace pdepenv_xfnum=. if year==2007 & province=="Guangdong"
replace pdepenv_xfnum=. if year==2008 & province=="Guangdong"
replace cfinexptot= cfinexptot/100 if province=="InnerMongolia" & year==2005
replace cfinexptot= 2.9296e+11 if province=="Yunnan" & year==2011
replace cfinexptot= 7.7880e+10 if province=="Hainan" & year==2011
replace pdeplaborper= (pdeplabortot/cpopworktot)
replace pdeplaborsocnum=pdeplaborsins if pdeplaborsocnum==.
replace pdepletcournum=pdepletnum if pdepletcournum==.
drop pdeplaborsins pdepletnum
order p*, last

/*Generating working variables */
gen nat_count=12 if year==2007 /* Based on National_Consultation Dataset, outside data collected by author*/
replace nat_count=79 if year==2008
replace nat_count=109 if year==2009
replace nat_count=83 if year==2010
replace nat_count=121 if year==2011
replace nat_count=115 if year==2012

/*Standardize variables*/
g pdepletcourpc =  pdepletcournum*10000/cpoptot
g pdeplaborcoll_ptot=(pdeplaborcollnum/pdeplabortot) 
g cpopworkpc=(cpopworktot/cpopadulttot)
g pdeplabor_perwork = (pdeplabortot*10000/cpopworktot)
g pdeplaborcoll_perwork = (pdeplaborcollnum*10000/cpopworktot)
g oeconunempper = (oeconunempnum*10000/cpopworktot)
g pdepmass_per=(pdepmassnum*10000/cpoptot)
g air_pollute= (oenvairnum/360)*100
g pdepenv_xfper=(pdepenv_xfnum/cpoptot)*1000000
g pdepenv_xfvisitper=(pdepenv_xfvisit/cpoptot)*1000000
g pcsoper=(pcsonum/cpoptot)*1000000
g pdepletcitper= (pdepletcitnum*10000/cpoptot)
g pdepletcourper= (pdepletcournum*10000/cpoptot)
g pregppreqnum_per = (pregppreqnum/pregnum) 
g pregnotireqnum_per = (pregnotireqnum/pregnum) 
g pregpubhreqnum_per = (pregpubhreqnum/pregnum) 
g pregfeedreqnum_per = (pregfeedreqnum/pregnum) 
g pregfeedpublidum_per = (pregfeedpublidum/pregnum)

g comment= upnotifreq/usamplesize
g expendpc=cfinexptot/cpoptot
g pen= cpopnettot/ cpoptot
g pdeplabornumper= (pdeplabornum/cpopworktot)
g urban_share =cpopworkurban/cpopworktot

*Participation Variables, annual*
egen count_year = sum(count), by(year)
egen pregpubhreqnum_year = sum(pregpubhreqnum), by(year)
egen labor_year = sum(labor), by(year)
egen pladordraftnum_year = sum(plabordraftnum), by(year)
egen env_year = sum(env), by(year)
*
egen pcsonum_year = mean(pcsonum), by(year)
egen pcsoprinum_year = mean(pcsonum), by(year)
egen pcsofoundnum_year = mean(pcsofoundnum), by(year) 
egen penvcsonum_year = mean(penvcsonum), by(year)
egen penvnprofitnum_year = mean(penvnprofitnum), by(year)
egen penvfoundnum_year = mean(penvfoundnum), by(year)
egen pdepletcongnum_year = mean(pdepletcongnum), by(year)
egen pdepenv_pcjianyi_year = mean(pdepenv_pcjianyi), by(year)

/****ENVIRONMENT IV's*****/
set more off
g envdum=0
replace envdum=1 if env>0
g ln_oenvwatertot= ln(oenvwatertot)
g ln_penvinvest=ln(penvinvest)
*General CSOs*
egen pcsoper_z2 =std(pcsoper)
g envdumXpcsoper_z2 = envdum*pcsoper_z2
*General Non-Profits*
g pcsopriper=(pcsoprinum/cpoptot)*1000000
egen pcsopriper_z2 =std(pcsopriper)
g envdumXpcsopriper_z2 = envdum*pcsopriper_z2
*Environmental CSOs*
g penvcsoper=(penvcsonum/cpoptot)*1000000
egen penvcsoper_z2 =std(penvcsoper)
g envdumXpenvcsoper_z2 = envdum*penvcsoper_z2
*Environmental Non-Profits*
g penvnproper=(penvnprofitnum/cpoptot)*1000000
egen penvnproper_z2 =std(penvnproper)
g envdumXpenvnproper_z2 = envdum*penvnproper_z2

**Dependent Variables**
*broad* 
egen pdepletcitper_year = mean(pdepletcitper), by(year)
egen pdepmass_per_year = mean(pdepmass_per), by(year)
*labor*
egen pdeplaborcoll_perwork_year = mean(pdeplaborcoll_perwork), by(year)
egen pdeplabor_perwork_year = mean(pdeplabor_perwork), by(year)
*env*
egen pdepenvadpennum_year = mean(pdepenvadpennum), by(year)
egen pdepenvadpenfine_year = mean(pdepenvadpenfine), by(year)
egen pdepenvadrevnum_year = mean(pdepenvadrevnum), by(year)
egen pdepenvlitnum_year = mean(pdepenvlitnum), by(year)
egen pdepenv_xfvisit_year = mean(pdepenv_xfvisit), by(year)
egen pdepenv_xfnum_year = sum(pdepenv_xfnum), by(year)

/*Transforming Variables */ 
foreach var of varlist cpoptot oenvwaternum pdepmassnum pdepletcitnum pdepletcournum pdepenvadpennum ///
pdepletcongnum pdepenvadrevnum cpopworktot oeconunempper cecongrpnum plabordraftnum pdeplabortot{
g ln_`var'=ln(`var')
}
replace ln_plabordraftnum=0 if plabordraftnum==0


**Lables for new Variables*
label variable pdeplaborcoll_ptot "Collective Labor Dispute Share"
label variable cpopworkpc "Working adults share"
label variable pdepletcourpc "letters to prov courts per capita"
label variable gdp_pc "per capita GDP"
label variable plabordraftnum "Mean Union Participation in draft regs"
label variable plabormeetnum "Mean Union meet in draft regs"
label variable ppubhacpnum "No. of public hearings held by provincial LAO"
label variable pscoccnum  "No. of Social Organizations"
label variable pdeplaborpwinnum "Labor disputes partially won by labor"
label variable pdeplabor_perwork "pdeplabortot*10000/cpopworktot"
label variable psewagerev "sewage fees"
label variable pdepenv_loclaw "no. of local environmental laws"
label variable pdepenvadpenh~g "no. of penalty cases involving public hearing"
label variable pdepenvadpenf~e "amount of environmental fees assessed"
label variable pdepenvadpen_~e "no. environmental penalty cases processed"
label variable pdepenvadrevn~e "no. environmental admin review cases accepted"
label variable pdepenvadrevn~d  "no. environmental admin review cases decided"
label variable pdepenvlitnum "no. environmental litigation cases"
label variable pdepenvlitnum_decide "no. environmental litigation cases decided"
label variable pdepenvlitnum_epawin "no. environmental litigation cases won by EPA"
label variable pdepenv_xfnum "no. environmental xinfang"
label variable pdepenv_xfres "no. environmental xinfang responses"
label variable pdepenv_xfbatch "no. environmental xinfang batches"
label variable pdepenv_xfresbatch "no. environmental xinfang batches responses"
label variable pdepenv_xfvisit "no. environmental xinfang visits"
label variable pdepenv_pcyian  "no. environmental bills"
label variable pdepenv_pcjianyi  "no. environmental proposals"
label variable pdepenv_ppccj~i "no. environmental proposals from CPPCC"
label variable pdepenv_ppccj~p "no. environmental proposals from CPPCC processed"
label variable pdepletcongnum "no. proposals raised by prov RenDa"
label variable pdeppccnum "PC31 proposals from the CPPCC "
label define provincecode 1"Beijing" 2"Tianjin" 3"Hebei" 4"Shanxi" 5"InnerMongolia" ///
6"Liaoning" 7"Jilin" 8"Heilongjiang" 9"Shanghai" 10"Jiangsu" 11"Zhejiang" 12"Anhui" ///
13"Fujian" 14"Jiangxi" 15"Shandong" 16"Henan" 17"Hubei" 18"Hunan" 19"Guangdong" 20"Guangxi" ///
21"Hainan" 22"Chongqing" 23"Sichuan" 24"Guizhou" 25"Yunnan" 26"Tibet" 27"Shaanxi" 28"Gansu" ///
29"Qinghai" 30"Ningxia"  31"Xinjiang"
label values provincecode provincecode


/*Begin results output*/
cd "../Results"

preserve
drop if year>2012
lowess pdepmass_per_year year, lineopts(lpattern(solid)) title(Mass incidents, size(mediumsmall)) ///
ytitle(Events (x10,000 citizens), size(small)) xtitle(Year, size(mediumsmall)) ylabel(, labsize(small)) ///
scheme(s1mono) note(,size(zero)) name(pdepmass_per_year_lowess)
*
lowess pdepletcitper_year year, lineopts(lpattern(solid)) title(Letters and visits, size(mediumsmall)) ///
ytitle(Petitions (x10,000 citizens), size(small)) xtitle(Year, size(mediumsmall)) ylabel(, labsize(small)) ///
scheme(s1mono) note(,size(zero)) name(pdepletcitper_year_lowess)
*
lowess pdeplaborcoll_perwork_year year, lineopts(lpattern(solid)) title(Collective labor disputes, size(mediumsmall)) ///
ytitle(Disputes (x10,000 workers), size(small)) xtitle(Year, size(mediumsmall)) ylabel(, labsize(small)) ///
scheme(s1mono) note(,size(zero)) name(pdeplaborcoll_perwork_lowess)
*
lowess pdeplabor_perwork_year year, lineopts(lpattern(solid)) title(Labor disputes, size(mediumsmall)) ///
ytitle(Disputes (x10,000 workers), size(mediumsmall)) xtitle(, size(mediumsmall)) ylabel(, labsize(small)) ///
scheme(s1mono) note(,size(zero))  name(pdeplabor_perwork_year_lowess)
*
lowess pdepenvadpennum_year year, lineopts(lpattern(solid)) ylabel(#3) title(Environmental non-compliance, size(mediumsmall)) ///
ytitle(No. penalties, size(small)) xtitle(Year, size(mediumsmall)) ylabel(, labsize(small)) ///
scheme(s1mono) note(,size(zero)) name(pdepenvadpennum_year_lowess)
restore

/*Lowess Graphs Independent Variable*/
preserve 
collapse count pcsonum pdepletcongnum plabordraftnum pdepenv_pcjianyi, by(year)
lowess count year if year>2003 & year<2013, msize(large) lineopts(lpattern(solid)) title(Citizen, size(large)) ///
ytitle(Notice and Comment Activities, size(large)) xtitle(Year) ylabel(, labsize(large)) scheme(s1mono) note(,size(zero)) name(nc_lowess)
lowess pcsonum year if year<2013, msize(large) lineopts(lpattern(solid)) title(Civil Society, size(large)) ///
ytitle(Number of Registered CSOs, size(large)) ylabel(#3, labsize(large)) xtitle(Year) scheme(s1mono) note(,size(zero)) name(CSO_lowess)
lowess pdepletcongnum year if year<2013, msize(large) lineopts(lpattern(solid)) title(Legislative, size(large)) ///
ytitle(Congress Proposals Submitted, size(large)) xtitle(Year) ylabel(, labsize(large)) scheme(s1mono) note(,size(zero)) name(legislative_lowess)
restore

/*Lowess Graphs Dependent Variable*/
preserve 
collapse (median) pdepmassper pdepletcitper pdepenv_xfnum pdeplaborcollnum pdepenvadpenfine (mean) pdepenvadpennum , by(year)
drop if year>2012
lowess pdepenv_xfnum year, msize(large) lineopts(lpattern(solid)) title(Environmental xinfang, size(vlarge)) ///
ytitle(Number of complaints received, size(large)) xlabel(, labsize(large)) ///
ylabel(#3, labsize(large) angle(horizontal) format(%9.0gc)) xtitle(, size(zero)) scheme(s1mono) note(,size(zero)) name(pdepenv_xfnum_lowess)
lowess pdepenvadpenfine year,msize(large) lineopts(lpattern(solid)) title(Environmental fines, size(vlarge)) ///
ytitle(Number of fines issued, size(large)) xlabel(, labsize(large)) ///
ylabel(#3, labsize(large) angle(horizontal) format(%9.0gc)) xtitle(, size(zero)) scheme(s1mono) note(,size(zero)) name(pdepenvadpenfine_lowess)
lowess pdepenvadpennum year, msize(large) lineopts(lpattern(solid)) title(Environmental penalties, size(vlarge)) ///
ytitle(Number of penalties issued, size(large)) xlabel(, labsize(large)) ///
ylabel(#3, labsize(large) angle(horizontal) format(%9.0gc)) xtitle(, size(zero)) scheme(s1mono) note(,size(zero)) name(environmentpenalty_lowess)
restore

/* Figure 6.2 Summary of main independent variables */
graph combine nc_lowess legislative_lowess CSO_lowess, rows(1) title(Policy Participation, size(zero)) ///
note(*Average Province Reported, size(vsmall) pos(5)) scheme(s1mono) xsize(5) ysize(2)
graph save "fig_6.2_iv_summary.gph", replace

/*Figure 6.3 Compare with Unirule*/
preserve
drop if year<2004
drop if year>2012
collapse (mean)count (max)comment, by(provincecode) 
pwcorr count comment, star(05)
twoway (scatter comment count, mlabel(prov)), ytitle(Proportion solicited for comments) xtitle(Notice-and-comment campaigns) xscale(range(0 7)) xlabel(#6)
graph save Graph "fig_6.3_unirule_comparison.gph", replace
restore 

/* Figure 6.4 Measuring Citizen Interest (Note: this graphic references external data collected by the author but not included in the CGAP dataset).*/
preserve
use "../Data/Baidu_law.dta", clear
keep if law_code==23 | law_code==24 | law_code==2 | law_code==5
xtline pc_week, lcolor(gs10) addplot((line pc_week date_x if treat2==1, lcolor(black))) ///
ytitle(Baidu search index (national) weekly average) ylabel(, angle(horizontal)) ttitle(, size(zero)) ///
tlabel(, valuelabel) byopts(legend(on)) legend(order(2 "Notice-and-comment-campaign"))
graph save "fig_6.4_baidu_law.gph", replace
restore

/* Table 6.2 (Note: this graphic references external data collected by the author but not included in the CGAP dataset).*/
preserve
use "../Data/Baidu_law.dta", clear
g treat3=. 
order date treat* 
replace treat3=treat2[_n+32]
g treat4=. 
replace treat4=treat2[_n-32]
g treat5=. 
replace treat5=treat2[_n+75]
ttest pcindex, by(treat)
ttest pcindex, by(treat2)
ttest pcindex, by(treat3)
ttest pcindex, by(treat4)
ttest pcindex, by(treat5)
restore

/* Figure 6.5 Summary of mass incidents (Note: this graphic references external data collected by the author but not included in the CGAP dataset) */
preserve
use "../Data/Mass Incidents.dta", clear
twoway (connected mass year, yaxis(1) ytitle(Mass incidents)) (connected large year, msymbol(square) mcolor(black) lcolor(black) yaxis(2) ytitle(Large-scale events, axis(2))), ///
xtitle(, size(zero)) ylabel(, labsize(small) angle(horizontal) format(%9.0gc)) legend(size(small) order(1 "National" 2 ">500 Participants") position(11) rows(2) ring(0))  xlabel(#4)
graph save "fig_6.5_mass_incidents.gph", replace
restore

/*Figure 6.6 Descriptive Statistics on Collective and Individual Labor Disputes over time*/
graph bar (sum) pdeplabortot (sum) pdeplaborcollnum if year>1991 & year<2012, over(year, label(angle(forty_five) labsize(small))) bar(1, fcolor(gray)) bar(2, fcolor(black)) ylabel(, angle(horizontal) format(%9.0gc)) ///
legend(order(1 "Individual labor disputes" 2 "Collective labor disputes" ) rows(2) size(small) bmargin(medlarge) position(10) ring(0))
graph save "fig_6.6_labor_disputes.gph", replace

/* Figure 6.7 Summary of Enviornmental Compliance and Contestation over time*/
graph combine environmentpenalty_lowess pdepenvadpenfine_lowess pdepenv_xfnum_lowess , rows(1) title(, size(zero)) xsize(15) ysize(5.5) 
graph save "fig_6.7_environemntal_compliance_contestation.gph", replace

/* Figure 6.8 Summary of main dependent variables */
graph combine pdepmass_per_year_lowess pdepletcitper_year_lowess pdeplaborcoll_perwork_lowess pdepenvadpennum_year_lowess, rows(3) title(, size(zero))
graph save "fig_6.8_dv_summary.gph", replace

/* Figure 7.3 Participation across cases */
graph hbar (mean) count if year>2007, over(province, sort(count) descending label(labsize(vsmall))) ///
bar(1, fcolor(gray)) bar(2, fcolor(black)) ytitle(Provincial notice-and-comment campaigns) ylabel(, angle(horizontal) format(%9.0gc)) ///
legend(order(1 "Individual labor disputes" 2 "Collective labor disputes" ) rows(2) size(small) bmargin(medlarge) position(10) ring(0))
graph save "fig_7.3_cases.gph", replace


/**** Table 6.3 Broad Assessment of Consultation and Compliance *****/
drop if year>2012
xtreg d.pdepmassper d.l.count, fe 
outreg2 using general_comp_f.xls, excel e(all) replace
xtreg d.pdepmassper d.l.count d.cpoptot d.gdp d.cfine d.pdepletcongnum d.pcsoper, fe 
outreg2 using general_comp_f.xls, e(all)
xtreg d.pdepmassper d.l.count d.cpoptot d.gdp d.cfine d.pdepletcongnum d.pcsoper i.year, fe 
outreg2 using general_comp_f.xls, e(all)
** Letters and Visits to Gov**
xtreg d.pdepletcitper d.l.count, fe 
outreg2 using general_comp_f.xls, e(all)
xtreg d.pdepletcitper d.l.count d.cpoptot d.gdp d.cfine d.pdepletcongnum d.pcsoper, fe
outreg2 using general_comp_f.xls, e(all)
xtreg d.pdepletcitper d.l.count d.cpoptot d.gdp d.cfine d.pdepletcongnum d.pcsoper i.year, fe cluster(provincecode)
outreg2 using general_comp_f.xls, e(all)


/** Table 6.4 Policy-speci c assessment (labor) **/
*Labor Individual Disputes Union*
xtreg d.pdeplabortot dl.plabordraftnum dl.labor_t if year<2004, fe
outreg2 using labor_f.xls, excel e(all) replace
xtreg d.pdeplabortot dl.plabordraftnum dl.labor_t d.cpopworkurban d.oeconunempyrnum d.gdp i.year if year<2003, fe
outreg2 using labor_f.xls, excel e(all)
*Labor Collective Disputes Union*
xtreg d.pdeplaborcollnum dl.plabordraftnum dl.labor_t if year<2003, fe
outreg2 using labor_f.xls, excel e(all)
xtreg d.pdeplaborcollnum dl.plabordraftnum dl.labor_t d.cpopworkurban d.oeconunempyrnum d.gdp i.year if year<2003, fe
outreg2 using labor_f.xls, excel e(all)
*Labor Individual Disputes*
xtreg d.pdeplabortot dl.labor dl.labor_t if year>2003, fe
outreg2 using labor_f.xls, excel e(all)
xtreg d.pdeplabortot dl.labor dl.labor_t d.cpopworkurban d.oeconunempyrnum d.gdp i.year if year>2003, fe
outreg2 using labor_f.xls, excel e(all)
*Labor Collective Disputes*
xtreg d.pdeplaborcollnum dl.labor dl.labor_t if year>2003, fe
outreg2 using labor_f.xls, excel e(all)
xtreg d.pdeplaborcollnum dl.labor dl.labor_t d.cpopworkurban d.oeconunempyrnum d.gdp i.year if year>2003, fe
outreg2 using labor_f.xls, excel e(all)


** Table 6.5 Policy-specific assessment (environment) **
set more off
xtreg d.pdepenvadpennum dl.env dl.envi if year>2003, fe
outreg2 using environment_comply_f.xls, excel e(all) replace
xtreg d.pdepenvadpennum dl.env dl.envi d.pcsoper d.pdepenv_pcjianyi d.gdp d.penvinvest i.year if year>2003, fe
outreg2 using environment_comply_f.xls, excel e(all) 
*Env Fines*
xtreg d.pdepenvadpenfine dl.env dl.envi if year>2003, fe
outreg2 using environment_comply_f.xls, excel e(all) 
xtreg d.pdepenvadpenfine dl.env dl.envi d.pcsoper d.pdepenv_pcjianyi d.gdp d.penvinvest i.year if year>2003, fe
outreg2 using environment_comply_f.xls, excel e(all) 
*Env Letters*
xtreg d.pdepenv_xfnum dl.env dl.envi if year>2003, fe
outreg2 using environment_comply_f.xls, excel e(all) 
xtreg d.pdepenv_xfnum dl.env dl.envi d.pcsoper d.pdepenv_pcjianyi d.gdp d.penvinvest i.year if year>2003, fe
outreg2 using environment_comply_f.xls, excel e(all) 
*Env Visits*
xtreg d.pdepenv_xfvisit dl.env dl.envi if year>2003, fe
outreg2 using environment_comply_f.xls, excel e(all) 
xtreg d.pdepenv_xfvisit dl.env dl.envi d.pcsoper d.pdepenv_pcjianyi d.gdp d.penvinvest i.year if year>2003, fe
outreg2 using environment_comply_f.xls, excel e(all) 

** Table 6.6 Policy effectiveness **
*Water*
xtreg d.pdepenvwat dl.env dl.envi if year>2003, fe
outreg2 using environment_quality_f.xls, excel e(all) replace
xtreg d.pdepenvwat dl.env dl.envi d.pdepenv_pcjianyi d.pcsoper d.gdp d.penvinvest i.year if year>2003, fe
outreg2 using environment_quality_f.xls, excel e(all)
xtreg d.pdepenvwat dl.envdum d.envdumXpcsoper_z2 d.pcsoper_z2 d.pdepenv_pcjianyi d.gdp d.penvinvest i.year if year>2003, fe
outreg2 using environment_quality_f.xls, excel e(all)
*Air*
xtreg d.air dl.env dl.envi if year>2003, fe
outreg2 using environment_quality_f.xls, excel e(all)
xtreg d.air dl.env dl.envi d.pdepenv_pcjianyi d.pcsoper d.gdp d.penvinvest i.year if year>2003, fe
outreg2 using environment_quality_f.xls, excel e(all)
xtreg d.air dl.envdum d.envdumXpcsoper_z2 d.pcsoper_z2 d.pdepenv_pcjianyi d.gdp d.penvinvest i.year if year>2003, fe
outreg2 using environment_quality_f.xls, excel e(all)

